package cn.lili.controller.feign.member;

import cn.lili.modules.member.client.UserAddressClient;
import cn.lili.modules.member.entity.dos.UserAddress;
import cn.lili.modules.member.entity.dto.AddressSearchParams;
import cn.lili.modules.member.service.UserAddressService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户收货地址 feign client
 *
 * @author Chopper
 * @version v1.0
 * 2021-11-17 18:06
 */
@RestController
@RequiredArgsConstructor
public class UserAddressFeignController implements UserAddressClient {

    private final UserAddressService userAddressService;

    @Override
    public UserAddress getUserDefaultAddress(String userId) {
        return userAddressService.getUserDefaultAddress(userId);
    }

    @Override
    public UserAddress getAddressById(String shippingAddressId) {
        return userAddressService.getUserAddress(shippingAddressId);
    }

    @Override
    public UserAddress getAddressByIdNoAuth(String id) {
        return userAddressService.getById(id);
    }

    @Override
    public UserAddress getByParams(AddressSearchParams addressSearchParams) {
        return userAddressService.getUserAddressNoAuth(addressSearchParams);
    }
}
